package cn.john.hrm.feign;

import cn.john.hrm.doc.CourseDoc;
import cn.john.hrm.query.CourseDocQuery;
import cn.john.hrm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class AddCourseDocFallBackFactory implements FallbackFactory<AddCourseDocClient> {
    @Override
    public AddCourseDocClient create(Throwable throwable) {
        return new AddCourseDocClient() {
            @Override
            public AjaxResult add(CourseDoc courseDoc) {
                return AjaxResult.me().setSuccess(false).setMessage("课程上线失败，请联系管理员");
            }

            @Override
            public AjaxResult queryCourses(CourseDocQuery query) {
                return AjaxResult.me().setSuccess(false).setMessage("搜索服务异常，请联系管理员");
            }
        };
    }
}
